#ifndef AI_H
#define AI_H
#include <QtGui>
#include "ui_ai.h"
#include "Action.h"
#include "SetDialog.h"
#include "GameSetting.h"
#include "GameState.h"
#include "Grid.h"
class ai : public QWidget
{
    Q_OBJECT

	public:
		ai(QWidget *parent = 0);
		SetDialog *dlgSet;
		GameSetting setting;
		GameState currentState;
		Grid **gridTable;
		void initUiElement(QApplication &AiApp);
		~ai();
	public slots:
		void moveNextStep(int i,int j);
	private slots:
		GameState generateGameState(const GameSetting&);
		void changeSetting();
		void renderGameBoard(const GameState &state);
		void changeBoard(GameState &state);
	private:
		void flushText(GameState& currentState);
		int Max_Value(GameState& state,int alpha,int beta);
		int Min_Value(GameState& state,int alpha,int beta);
		Action Alpha_Beta_Search(GameState& currentState);
		GameState getNextState(const int& i, const int& j, const GameState &currentState);
		Ui::aiClass ui;
};

#endif // AI_H
